/*oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO

Authors: Nitay Megides
		 Rachel Banino

Project: Exercise 3

Using:	Manager.h
		Debug.h

Description:
The main entry point for the application.
oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO*/

#include "Manager.h"
#include <stdio.h>
#include "Debug.h"

// Main - The entry point of the application
// Command line parameters:
// 1. Bitmap filename
// 2. Output filename
// 3. FaceWidth
// 4. FaceHeight
// 5. Number of vertical areas
// 6. Number of horizontal areas
// 7. Number of threads allowed to run in parallel
// 8. Debug file prefix (Optional)
int main(int argc, char* argv[])
{
	// Read all parameters
	int faceWidth = atoi(argv[3]);
	int faceHeight = atoi(argv[4]);
	
	int numberOfAreasVertical = atoi(argv[5]);
	int numberOfAreasHorizontal = atoi(argv[6]);

	int numberofParallelThreads = atoi(argv[7]);

	// Initialize the manager
	if (ManagerInitialize(argv[1], argv[2], faceWidth, faceHeight, numberOfAreasVertical, numberOfAreasHorizontal, numberofParallelThreads))
	{
		ManagerRun();

		// Check for the debug option
		if (argc > 8)
			GenerateDebugFiles(argv[8]);

		// Wait until it's done
		WaitForProgramTerminate(INFINITE);
	}

	ManagerFree();

	return 0;
}

